package com.ihy.config;

import com.sun.istack.NotNull;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class DefaultMvcConfig implements WebMvcConfigurer {
    /**
     * 默认视图
     *
     * @return 默认访问服务器根路径 跳转到index.html 欢迎页
     */
    @Bean
    public WebMvcConfigurer getWebMvcConfigurerAdapter() {
        return new WebMvcConfigurer() {
            @SuppressWarnings("SpringMVCViewInspection")
            @Override
            public void addViewControllers(@NotNull ViewControllerRegistry registry) {
                registry.addViewController("/").setViewName("index.html");
            }
        };
    }
}